package com.zuihai.app.mvp.ui.utils;

import android.text.TextUtils;

/**
 * Created by Administrator on 2017/5/23 0023.
 */

public class RegularUtils {

    /**
     * 校验手机号
     *
     * @param number
     * @return 校验通过返回true，否则返回false
     */
    public static  boolean isMobile(String number) {

        if (number.length()==11) {
            return true;
        } else {
            return false;
        }
    }
    /**
     * 校验手机号
     *
     * @param number
     * @return 校验通过返回true，否则返回false
     */
    public static  boolean isMobile1(String number) {

        String numberPhone = "[1][3458]\\d{9}";
        if (TextUtils.isEmpty(number)) {
            return false;
        } else {
            return number.matches(numberPhone);
        }
    }

    /**
     * 校验密码
     *
     * @param mPassword
     * @return 校验通过返回true，否则返回false
     */
    public static boolean isPassword(String mPassword) {

        String password = "^[a-zA-Z0-9]{6,16}$";
        if (TextUtils.isEmpty(mPassword)) {
            return false;
        } else {
            return mPassword.matches(password);
        }
    }
}
